<!DOCTYPE html>
<html>
<head>
    <title>Intermediate Value Models - Comparison Report</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 20px;
            background-color: #f5f5f5;
        }
        .container {
            max-width: 1400px;
            margin: 0 auto;
            background-color: white;
            padding: 30px;
            box-shadow: 0 0 10px rgba(0,0,0,0.1);
        }
        h1 {
            color: #333;
            border-bottom: 3px solid #4CAF50;
            padding-bottom: 10px;
        }
        h2 {
            color: #555;
            margin-top: 30px;
        }
        table {
            border-collapse: collapse;
            width: 100%;
            margin: 20px 0;
        }
        th, td {
            border: 1px solid #ddd;
            padding: 12px;
            text-align: left;
        }
        th {
            background-color: #4CAF50;
            color: white;
        }
        tr:nth-child(even) {
            background-color: #f9f9f9;
        }
        .sig-high { background-color: #d4edda; }
        .sig-medium { background-color: #fff3cd; }
        .sig-low { background-color: #f8d7da; }
        .metric { font-weight: bold; }
        .timestamp {
            color: #888;
            font-size: 0.9em;
        }
        img {
            max-width: 100%;
            margin: 20px 0;
            border: 1px solid #ddd;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>Intermediate Value Models - Correlation Analysis Report</h1>
        <p class="timestamp">Generated: 2025-10-13 20:35:02</p>
        
        <h2>Overall Ranking (Top 20)</h2>
        <table>
            <tr>
                <th>Rank</th>
                <th>Algorithm</th>
                <th>Model</th>
                <th>|Pearson|</th>
                <th>P-value</th>
                <th>Significance</th>
                <th>CPU Mean</th>
            </tr>

            <tr class="sig-high">
                <td>1</td>
                <td>AES-128</td>
                <td>round_key_xor</td>
                <td class="metric">0.1229</td>
                <td>0.006017</td>
                <td>weak</td>
                <td>48.05%</td>
            </tr>

            <tr class="sig-medium">
                <td>2</td>
                <td>SM4</td>
                <td>hw_sbox_output</td>
                <td class="metric">0.0910</td>
                <td>0.042294</td>
                <td>very_weak</td>
                <td>49.10%</td>
            </tr>

            <tr class="sig-low">
                <td>3</td>
                <td>SM4</td>
                <td>sbox_output</td>
                <td class="metric">0.0778</td>
                <td>0.082560</td>
                <td>very_weak</td>
                <td>57.76%</td>
            </tr>

            <tr class="sig-low">
                <td>4</td>
                <td>RSA-2048</td>
                <td>hw_result</td>
                <td class="metric">0.0767</td>
                <td>0.086992</td>
                <td>very_weak</td>
                <td>48.73%</td>
            </tr>

            <tr class="sig-low">
                <td>5</td>
                <td>SM2</td>
                <td>scalar_mult_step</td>
                <td class="metric">0.0690</td>
                <td>0.123884</td>
                <td>very_weak</td>
                <td>47.18%</td>
            </tr>

            <tr class="sig-low">
                <td>6</td>
                <td>Dilithium-2</td>
                <td>rejection_sampling</td>
                <td class="metric">0.0635</td>
                <td>0.156981</td>
                <td>very_weak</td>
                <td>47.56%</td>
            </tr>

            <tr class="sig-low">
                <td>7</td>
                <td>Dilithium-2</td>
                <td>modular_red</td>
                <td class="metric">0.0593</td>
                <td>0.185754</td>
                <td>very_weak</td>
                <td>47.21%</td>
            </tr>

            <tr class="sig-low">
                <td>8</td>
                <td>RSA-2048</td>
                <td>square_op</td>
                <td class="metric">0.0555</td>
                <td>0.215907</td>
                <td>very_weak</td>
                <td>47.20%</td>
            </tr>

            <tr class="sig-low">
                <td>9</td>
                <td>SM2</td>
                <td>point_add_x</td>
                <td class="metric">0.0547</td>
                <td>0.222417</td>
                <td>very_weak</td>
                <td>48.02%</td>
            </tr>

            <tr class="sig-low">
                <td>10</td>
                <td>SM4</td>
                <td>sbox_input</td>
                <td class="metric">0.0535</td>
                <td>0.232797</td>
                <td>very_weak</td>
                <td>48.79%</td>
            </tr>

            <tr class="sig-low">
                <td>11</td>
                <td>SM4</td>
                <td>tau_transform</td>
                <td class="metric">0.0528</td>
                <td>0.238925</td>
                <td>very_weak</td>
                <td>49.20%</td>
            </tr>

            <tr class="sig-low">
                <td>12</td>
                <td>AES-128</td>
                <td>sbox_input</td>
                <td class="metric">0.0433</td>
                <td>0.333752</td>
                <td>very_weak</td>
                <td>58.81%</td>
            </tr>

            <tr class="sig-low">
                <td>13</td>
                <td>ECC-P256</td>
                <td>point_add_x</td>
                <td class="metric">0.0319</td>
                <td>0.477087</td>
                <td>very_weak</td>
                <td>48.12%</td>
            </tr>

            <tr class="sig-low">
                <td>14</td>
                <td>Dilithium-2</td>
                <td>poly_mult</td>
                <td class="metric">0.0299</td>
                <td>0.504987</td>
                <td>very_weak</td>
                <td>47.99%</td>
            </tr>

            <tr class="sig-low">
                <td>15</td>
                <td>RSA-2048</td>
                <td>modular_mult</td>
                <td class="metric">0.0281</td>
                <td>0.531529</td>
                <td>very_weak</td>
                <td>47.78%</td>
            </tr>

            <tr class="sig-low">
                <td>16</td>
                <td>ECC-P256</td>
                <td>point_dbl_x</td>
                <td class="metric">0.0275</td>
                <td>0.540992</td>
                <td>very_weak</td>
                <td>47.07%</td>
            </tr>

            <tr class="sig-low">
                <td>17</td>
                <td>AES-128</td>
                <td>sbox_output</td>
                <td class="metric">0.0251</td>
                <td>0.575998</td>
                <td>very_weak</td>
                <td>47.22%</td>
            </tr>

            <tr class="sig-low">
                <td>18</td>
                <td>AES-128</td>
                <td>hd_plaintext_sbox</td>
                <td class="metric">0.0195</td>
                <td>0.664348</td>
                <td>very_weak</td>
                <td>48.20%</td>
            </tr>

            <tr class="sig-low">
                <td>19</td>
                <td>ECC-P256</td>
                <td>scalar_mult_step</td>
                <td class="metric">0.0189</td>
                <td>0.674071</td>
                <td>very_weak</td>
                <td>48.20%</td>
            </tr>

            <tr class="sig-low">
                <td>20</td>
                <td>SM2</td>
                <td>point_dbl_x</td>
                <td class="metric">0.0172</td>
                <td>0.701368</td>
                <td>very_weak</td>
                <td>47.63%</td>
            </tr>

        </table>
        
        <h2>Visualization</h2>
        <img src="overall_ranking.png" alt="Overall Ranking">
        <img src="algorithm_comparison.png" alt="Algorithm Comparison">
        
        <h2>By Algorithm</h2>

        <h3>AES-128</h3>
        <table>
            <tr>
                <th>Model</th>
                <th>|Pearson|</th>
                <th>P-value</th>
                <th>Significance</th>
                <th>Spearman</th>
                <th>CPU Mean</th>
                <th>Unique Values</th>
            </tr>

            <tr class="sig-high">
                <td>round_key_xor</td>
                <td class="metric">0.1229</td>
                <td>0.006017</td>
                <td>weak</td>
                <td>-0.1132</td>
                <td>48.05%</td>
                <td>230</td>
            </tr>

            <tr class="sig-low">
                <td>sbox_input</td>
                <td class="metric">0.0433</td>
                <td>0.333752</td>
                <td>very_weak</td>
                <td>-0.0674</td>
                <td>58.81%</td>
                <td>220</td>
            </tr>

            <tr class="sig-low">
                <td>sbox_output</td>
                <td class="metric">0.0251</td>
                <td>0.575998</td>
                <td>very_weak</td>
                <td>-0.0156</td>
                <td>47.22%</td>
                <td>218</td>
            </tr>

            <tr class="sig-low">
                <td>hd_plaintext_sbox</td>
                <td class="metric">0.0195</td>
                <td>0.664348</td>
                <td>very_weak</td>
                <td>0.0330</td>
                <td>48.20%</td>
                <td>9</td>
            </tr>

            <tr class="sig-low">
                <td>hw_sbox_output</td>
                <td class="metric">0.0134</td>
                <td>0.765425</td>
                <td>very_weak</td>
                <td>-0.0003</td>
                <td>48.10%</td>
                <td>9</td>
            </tr>

            <tr class="sig-low">
                <td>hw_round_key_xor</td>
                <td class="metric">0.0003</td>
                <td>0.993913</td>
                <td>very_weak</td>
                <td>0.0197</td>
                <td>49.41%</td>
                <td>9</td>
            </tr>

        </table>

        <h3>Dilithium-2</h3>
        <table>
            <tr>
                <th>Model</th>
                <th>|Pearson|</th>
                <th>P-value</th>
                <th>Significance</th>
                <th>Spearman</th>
                <th>CPU Mean</th>
                <th>Unique Values</th>
            </tr>

            <tr class="sig-low">
                <td>rejection_sampling</td>
                <td class="metric">0.0635</td>
                <td>0.156981</td>
                <td>very_weak</td>
                <td>-0.0557</td>
                <td>47.56%</td>
                <td>500</td>
            </tr>

            <tr class="sig-low">
                <td>modular_red</td>
                <td class="metric">0.0593</td>
                <td>0.185754</td>
                <td>very_weak</td>
                <td>0.0578</td>
                <td>47.21%</td>
                <td>500</td>
            </tr>

            <tr class="sig-low">
                <td>poly_mult</td>
                <td class="metric">0.0299</td>
                <td>0.504987</td>
                <td>very_weak</td>
                <td>0.0516</td>
                <td>47.99%</td>
                <td>500</td>
            </tr>

            <tr class="sig-low">
                <td>ntt_butterfly</td>
                <td class="metric">0.0087</td>
                <td>0.846138</td>
                <td>very_weak</td>
                <td>0.0068</td>
                <td>51.44%</td>
                <td>500</td>
            </tr>

        </table>

        <h3>ECC-P256</h3>
        <table>
            <tr>
                <th>Model</th>
                <th>|Pearson|</th>
                <th>P-value</th>
                <th>Significance</th>
                <th>Spearman</th>
                <th>CPU Mean</th>
                <th>Unique Values</th>
            </tr>

            <tr class="sig-low">
                <td>point_add_x</td>
                <td class="metric">0.0319</td>
                <td>0.477087</td>
                <td>very_weak</td>
                <td>-0.0321</td>
                <td>48.12%</td>
                <td>500</td>
            </tr>

            <tr class="sig-low">
                <td>point_dbl_x</td>
                <td class="metric">0.0275</td>
                <td>0.540992</td>
                <td>very_weak</td>
                <td>-0.0370</td>
                <td>47.07%</td>
                <td>500</td>
            </tr>

            <tr class="sig-low">
                <td>scalar_mult_step</td>
                <td class="metric">0.0189</td>
                <td>0.674071</td>
                <td>very_weak</td>
                <td>-0.0242</td>
                <td>48.20%</td>
                <td>500</td>
            </tr>

            <tr class="sig-low">
                <td>hw_coordinate</td>
                <td class="metric">0.0111</td>
                <td>0.804483</td>
                <td>very_weak</td>
                <td>-0.0181</td>
                <td>47.98%</td>
                <td>17</td>
            </tr>

        </table>

        <h3>RSA-2048</h3>
        <table>
            <tr>
                <th>Model</th>
                <th>|Pearson|</th>
                <th>P-value</th>
                <th>Significance</th>
                <th>Spearman</th>
                <th>CPU Mean</th>
                <th>Unique Values</th>
            </tr>

            <tr class="sig-low">
                <td>hw_result</td>
                <td class="metric">0.0767</td>
                <td>0.086992</td>
                <td>very_weak</td>
                <td>0.0765</td>
                <td>48.73%</td>
                <td>16</td>
            </tr>

            <tr class="sig-low">
                <td>square_op</td>
                <td class="metric">0.0555</td>
                <td>0.215907</td>
                <td>very_weak</td>
                <td>-0.0536</td>
                <td>47.20%</td>
                <td>500</td>
            </tr>

            <tr class="sig-low">
                <td>modular_mult</td>
                <td class="metric">0.0281</td>
                <td>0.531529</td>
                <td>very_weak</td>
                <td>-0.0293</td>
                <td>47.78%</td>
                <td>500</td>
            </tr>

            <tr class="sig-low">
                <td>modular_add</td>
                <td class="metric">0.0105</td>
                <td>0.815852</td>
                <td>very_weak</td>
                <td>0.0096</td>
                <td>48.00%</td>
                <td>500</td>
            </tr>

        </table>

        <h3>SM2</h3>
        <table>
            <tr>
                <th>Model</th>
                <th>|Pearson|</th>
                <th>P-value</th>
                <th>Significance</th>
                <th>Spearman</th>
                <th>CPU Mean</th>
                <th>Unique Values</th>
            </tr>

            <tr class="sig-low">
                <td>scalar_mult_step</td>
                <td class="metric">0.0690</td>
                <td>0.123884</td>
                <td>very_weak</td>
                <td>-0.0921</td>
                <td>47.18%</td>
                <td>500</td>
            </tr>

            <tr class="sig-low">
                <td>point_add_x</td>
                <td class="metric">0.0547</td>
                <td>0.222417</td>
                <td>very_weak</td>
                <td>-0.0506</td>
                <td>48.02%</td>
                <td>500</td>
            </tr>

            <tr class="sig-low">
                <td>point_dbl_x</td>
                <td class="metric">0.0172</td>
                <td>0.701368</td>
                <td>very_weak</td>
                <td>0.0101</td>
                <td>47.63%</td>
                <td>500</td>
            </tr>

            <tr class="sig-low">
                <td>modular_op</td>
                <td class="metric">0.0137</td>
                <td>0.760241</td>
                <td>very_weak</td>
                <td>0.0219</td>
                <td>48.82%</td>
                <td>500</td>
            </tr>

        </table>

        <h3>SM4</h3>
        <table>
            <tr>
                <th>Model</th>
                <th>|Pearson|</th>
                <th>P-value</th>
                <th>Significance</th>
                <th>Spearman</th>
                <th>CPU Mean</th>
                <th>Unique Values</th>
            </tr>

            <tr class="sig-medium">
                <td>hw_sbox_output</td>
                <td class="metric">0.0910</td>
                <td>0.042294</td>
                <td>very_weak</td>
                <td>0.0667</td>
                <td>49.10%</td>
                <td>9</td>
            </tr>

            <tr class="sig-low">
                <td>sbox_output</td>
                <td class="metric">0.0778</td>
                <td>0.082560</td>
                <td>very_weak</td>
                <td>-0.0311</td>
                <td>57.76%</td>
                <td>219</td>
            </tr>

            <tr class="sig-low">
                <td>sbox_input</td>
                <td class="metric">0.0535</td>
                <td>0.232797</td>
                <td>very_weak</td>
                <td>0.0355</td>
                <td>48.79%</td>
                <td>226</td>
            </tr>

            <tr class="sig-low">
                <td>tau_transform</td>
                <td class="metric">0.0528</td>
                <td>0.238925</td>
                <td>very_weak</td>
                <td>0.0601</td>
                <td>49.20%</td>
                <td>500</td>
            </tr>

            <tr class="sig-low">
                <td>round_function_input</td>
                <td class="metric">0.0013</td>
                <td>0.976096</td>
                <td>very_weak</td>
                <td>-0.0045</td>
                <td>48.13%</td>
                <td>217</td>
            </tr>

        </table>

        <h2>Legend</h2>
        <ul>
            <li><strong>|Pearson|:</strong> Absolute value of Pearson correlation coefficient (0-1)</li>
            <li><strong>P-value:</strong> Statistical significance (< 0.05 is significant)</li>
            <li><strong>Significance:</strong> Correlation strength category</li>
            <li><strong>CPU Mean:</strong> Average CPU usage during trace collection</li>
            <li class="sig-high">Green background: Highly significant (p < 0.01)</li>
            <li class="sig-medium">Yellow background: Significant (p < 0.05)</li>
            <li class="sig-low">Red background: Not significant (p >= 0.05)</li>
        </ul>
    </div>
</body>
</html>
